home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / kernel / vm / sun4.md / vmMach.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-12-19  |  4.4 KB  |  159 lines

  1. /*
  2.  * vmMach.h
  3.  *
  4.  *         Machine dependent virtual memory data structures and procedure 
  5.  *    headers.
  6.  *
  7.  * Copyright (C) 1985 Regents of the University of California
  8.  * All rights reserved.
  9.  *
  10.  *
  11.  * $Header: /cdrom/src/kernel/Cvsroot/kernel/vm/sun4.md/vmMach.h,v 9.13 92/07/28 14:58:43 mgbaker Exp $ SPRITE (Berkeley)
  12.  */
  13.  
  14. #ifndef _VMMACH
  15. #define _VMMACH
  16.  
  17. #ifdef KERNEL
  18. #include "vm.h"
  19. #include "vmSunConst.h"
  20. #include "proc.h"
  21. #include "net.h"
  22. #else
  23. #include <kernel/vm.h>
  24. #include <kernel/vmSunConst.h>
  25. #include <kernel/proc.h>
  26. #include <kernel/net.h>
  27. #endif
  28.  
  29. /*
  30.  * Since the index into the segment table is passed to various
  31.  * machine-dependent routines, its size must depend on the hardware size
  32.  * or else be the largest size used, which would waste space.  So far, this
  33.  * has only been generalized for the various types of sun4s.
  34.  */
  35. #ifdef sun4
  36. #ifdef sun4c
  37. typedef    unsigned short    VMMACH_SEG_NUM;    /* should be unsigned char, but fails */
  38. #else
  39. typedef    unsigned short    VMMACH_SEG_NUM;
  40. #endif    /* sun4c */
  41. #endif    /* sun4 */
  42.  
  43. /*
  44.  * PMEG segment info list entry.
  45.  */
  46. #ifdef sun4
  47. struct VmMach_PMEGseg {
  48.     struct VmMach_PMEGseg      *nextLink;      /* Linked list ptr. */
  49.     struct Vm_Segment   *segPtr;        /* Software segment. */
  50.     int                 hardSegNum;     /* Hardware segment number. */
  51.     int                 inuse;
  52. };
  53. #endif
  54.  
  55. /*
  56.  * Machine dependent data for each software segment.  The data for each 
  57.  * segment is a hardware segment table that contains one entry for each
  58.  * hardware segment in the software segment's virtual address space.
  59.  * A hardware context is made up of several software segments.  The offset
  60.  * field in this struct is the offset into the context where this software
  61.  * segment begins.  The offset is in terms of hardware segments.
  62.  */
  63. typedef struct VmMach_SegData {
  64. #ifdef sun4
  65.     VMMACH_SEG_NUM    *segTablePtr;
  66. #else
  67.     unsigned char     *segTablePtr;
  68. #endif /* sun4 */
  69.     int            offset;
  70.     int            numSegs;
  71. #ifdef sun4
  72.     struct VmMach_PMEGseg    pmegInfo;
  73. #endif
  74. } VmMach_SegData;
  75.  
  76. /*
  77.  * Machine dependent shared memory data
  78.  */
  79. typedef struct VmMach_SharedData {
  80.     int        *allocVector;           /* Allocated block vector. */
  81.     int         allocFirstFree;         /* First free block. */
  82. } VmMach_SharedData;
  83.  
  84. /*
  85.  * Machine dependent data for each process.
  86.  */
  87. typedef struct VmMach_ProcData {
  88.     struct VmMach_Context *contextPtr;    /* The context for the process. */
  89.     struct Vm_Segment    *mapSegPtr;    /* Pointer to segment which is mapped
  90.                      * into this processes address
  91.                      * space. */
  92.     unsigned int    mapHardSeg;    /* Address in the mapped seg where 
  93.                      * the mapping begins. */
  94.     struct Vm_SegProcList *sharedPtr;    /* Shared memory data */
  95.     VmMach_SharedData   sharedData;     /* Data for shared memory. */
  96. } VmMach_ProcData;
  97.  
  98. typedef unsigned int    VmMachPTE;
  99.  
  100. /*
  101.  * Exported machine dependent functions.
  102.  */
  103.  
  104. /*
  105.  * Manipulating protection.
  106.  */
  107. extern void VmMach_SetProtForDbg _ARGS_((Boolean readWrite, int numBytes,
  108.     Address addr));
  109. /*
  110.  * Routines to copy data to/from user space.
  111.  */
  112. extern int  VmMachCopyEnd _ARGS_((void));
  113. extern ReturnStatus VmMach_IntMapKernelIntoUser _ARGS_((unsigned int
  114.     kernelVirtAddr, int numBytes, unsigned int userVirtAddr,
  115.     Address *newAddrPtr));
  116.  
  117.  
  118. /*
  119.  * Routines for the INTEL device driver.
  120.  */
  121. extern void VmMach_MapIntelPage _ARGS_((Address virtAddr));
  122. extern void VmMach_UnmapIntelPage _ARGS_((Address virtAddr));
  123.  
  124. /*
  125.  * Routines for DMA
  126.  */
  127. extern Address VmMach_32BitDMAAlloc _ARGS_((int numBytes, Address srcAddr));
  128. extern void VmMach_32BitDMAFree _ARGS_((int numBytes, Address mapAddr));
  129. extern ReturnStatus VmMach_DMAAllocContiguous _ARGS_((
  130.     Net_ScatterGather *inScatGathPtr, int scatGathLength,
  131.     Net_ScatterGather *outScatGathPtr));
  132.  
  133. /*
  134.  * Device mapping.
  135.  */
  136. extern Address VmMach_MapInDevice _ARGS_((Address devPhysAddr, int type));
  137. extern Address VmMach_MapInBigDevice _ARGS_((Address devPhysAddr, int numBytes,
  138.     int type));
  139. /*
  140.  * Network mapping routines.
  141.  */
  142. extern Address VmMach_NetMemAlloc _ARGS_((int numBytes));
  143. extern void VmMach_NetMapPacket _ARGS_((register Net_ScatterGather
  144.     *inScatGathPtr, register int scatGathLength,
  145.     register Net_ScatterGather *outScatGathPtr));
  146. /*
  147.  * Context routines.
  148.  */
  149. extern int VmMach_GetContext _ARGS_((Proc_ControlBlock *procPtr));
  150. extern void VmMach_FlushCurrentContext _ARGS_((void));
  151.  
  152. /*
  153.  * File Cache routines.
  154.  */
  155. extern void VmMach_LockCachePage _ARGS_((Address kernelAddress));
  156. extern void VmMach_UnlockCachePage _ARGS_((Address kernelAddress));
  157.  
  158. #endif /* _VMMACH */
  159.